﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Demo
{
    class Demo02
    {
        public static void FourNumber()
        {
            //编写一个程序，请用户输入一个四位整数，
            //将用户输入的四位数的千位、百位、十位和个位分别显示出来，
            //如5632，则显示“用户输入的千位为5，百位为6，十位为3，个位为2”

            Console.WriteLine("请输入一个四位整数:");
            int num = int.Parse(Console.ReadLine());
            int a = num / 1000;
            int b = (num - a * 1000)/ 100;
            int c = (num - a * 1000 - b * 100) / 10;
            int d = num - a * 1000 - b * 100 - c * 10;
            Console.WriteLine("千位:" + a);
            Console.WriteLine("百位:" + b);
            Console.WriteLine("十位:" + c);
            Console.WriteLine("个位:" + d);


        }
    }
}
